<%@page contentType="text/html; charset=utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basepath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="<%=basepath%>css/styles.css" />
<link rel="stylesheet" href="<%=basepath%>css/jquery.autocomplete.css" />
<link rel="stylesheet"
	href="<%=basepath%>css/font-awesome-4.7.0/css/font-awesome.min.css" />
<script src="<%=basepath%>js/jquery-3.6.0.js" type="text/javascript"></script>
<script src="<%=basepath%>js/jquery.autocomplete.js" type="text/javascript"></script>
<script
	src="<%=basepath%>js/jquery-validation-1.14.0/jquery.validate.js"
	type="text/javascript"></script>
</head>
<body>
	<div class="add">
		<form id="addform" action="<%=basepath%>wbw?method=waijie" method="post">
			<input type="hidden" name="leixing" value="外借">
			<table class="tableadd">
					<tr>
						<td>姓名</td>
						<td><input type="text" name="name" value="${user.name}">
						</td>
						<td>备注</td>
						<td><input type="text" name="beizhu"></td>
						
						<td>日期</td>
						<td><input type="date" name="date"></td>
					</tr>
					
					<tr>
						<td>型号</td>
						<td><input type="text" name="xinghao" id="searchInput"></td>
						<td>数量</td>
						<td><input type="text" name="num">不可超过最大库存</td>
						<td>类型</td>
						<td><input type="text" value="外借" disabled="true"></td>
					</tr>
					
			</table>
				<button class="wbwbtn" onclick="window.history.back(-1);" type="button">
								<i class="fa fa-arrow-left"></i> 返回
							</button>
							<button class="wbwbtn" type="submit">
								<i class="fa fa-save"></i> 保存
							</button>
		
		</form>
		
	</div>
	
	<script type="text/javascript">
	$(document).ready(function() {
		$.post("${basePath}/echartBar", {}, function(data, status) {
			var jsonArray = JSON.parse(data);
			var xArr = [];
			for (var i = 0; i < jsonArray.length; i++) {
				var obj = jsonArray[i];
				xArr.push(obj.xinghao);
			}

			$("#searchInput").autocomplete(jsonArray, {
				max : 8, //列表里的条目数
				minChars : 0, //自动完成激活之前填入的最小字符
				width : $("#searchInput").width() + 1, //提示的宽度，溢出隐藏
				scrollHeight : 300, //提示的高度，溢出显示滚动条
				matchContains : true, //包含匹配，就是data参数里的数据，是否只要包含文本框里的数据就显示
				autoFill : false, //自动填充
				formatItem : function(row, i, max) {
					return row.xinghao;
				},
				formatMatch : function(row, i, max) {
					return row.xinghao;
				},
				formatResult : function(row) {
					return row.xinghao;
				}
			}).result(function(event, row, formatted) {
				//alert($("#searchInput").width());
			});

		});
	});
</script>
	
</body>
</html>
